package com.doit.day01;

import org.apache.zookeeper.ZooKeeper;

public class DeleteDemo {
    public static void main(String[] args) throws Exception {
        //创建zk的对象
        ZooKeeper zk = new ZooKeeper("linux01:2181",2000,null);

        /**
         * 注意只能删除空节点
         * -1代表任何版本，如果是4，那么到这个版本才能删掉，否则就会报错
         * Exception in thread "main" org.apache.zookeeper.KeeperException$BadVersionException:
         * KeeperErrorCode = BadVersion for /teacher
         */
        zk.delete("/teacher",4);
        zk.close();
    }
}
